import 'package:flutter/material.dart';

class MyPageView extends StatefulWidget {
  const MyPageView({super.key});

  @override
  State<MyPageView> createState() => _MyPageViewState();
}

class _MyPageViewState extends State<MyPageView> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("PageView"),
      ),
      body: Center(
        child: PageView(
          scrollDirection: Axis.vertical, // 滑动方向，默认水平方向
          children: [
            Center(
              child: Text("第1屏", style: Theme.of(context).textTheme.displayLarge,),
            ),
            Center(
              child: Text("第2屏", style: Theme.of(context).textTheme.displayLarge,),
            ),
            Center(
              child: Text("第3屏", style: Theme.of(context).textTheme.displayLarge,),
            ),
            Center(
              child: Text("第4屏", style: Theme.of(context).textTheme.displayLarge,),
            ),
            Center(
              child: Text("第5屏", style: Theme.of(context).textTheme.displayLarge,),
            ),
          ],
        ),
      ),
    );
  }
}